package com.mark.article.job;

import com.mark.article.service.ApHotArticleService;
import com.mark.common.quartz.AbstractJob;
import lombok.extern.log4j.Log4j2;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description :  java类作用描述
 * @Author :  Markburt
 * @CreateDate :  2020/2/28$ 下午 01:21$
 * @UpdateUser :  Markburt
 * @UpdateDate :  2020/2/28$ 下午 01:21$
 * @UpdateRemark :  Project Build
 * @Version :  1.0
 */
@Component
@Log4j2
public class AppHotArticleQuartz extends AbstractJob {


    @Autowired
    private ApHotArticleService apHotArticleService;

    @Override
    public String[] triggerCron() {
        return new String[]{"0 0/1 * * * ?"};
    }


    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Long current = System.currentTimeMillis();
        log.info("开始定时计算分值 ......");
        apHotArticleService.computeHotArticle();
        log.info("计算分值完成，耗时:{}", System.currentTimeMillis() - current);
    }


    @Override
    public String descTrigger() {
        return "每日12：05执行一次 ";
    }
}
